<!DOCTYPE html>
<!--
  ~ Copyright (c) 2017 RockScript.io.
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>RockScript Documentation</title>

  <link rel="icon" href="favicon.ico" type="image/x-icon" />

  <link rel="stylesheet" type="text/css" href="css/highlight-arduino-light-9.12.0.css">
  <link rel="stylesheet" type="text/css" href="css/rockscript-docs.css">

  <script src="js/highlight-9.12.0.js"></script>
  <script src="js/jquery-3.2.1.min.js"></script>
  <script type="application/javascript">
    $(document).ready(function() {
      $('pre code').each(function(i, block) {
        hljs.highlightBlock(block);
      });
    });
  </script>

</head>
<body>

<a href="/">
  <div class="titlebar">
    <div class="brand">RockScript.io<img alt="RockScript.io" src="img/hand-white.png"></div>
    <div class="title">RockScript Documentation</div>
  </div>
</a>

<div class="toc">
  <a href="index">Introduction</a>
  <a href="why-and-when">Why and when</a>
  <a href="how-does-it-work">How does it work</a>
  <a href="project-status">Project status</a>
  <a href="getting-started">Getting started</a>
  <a href="cli">Command line interface</a>
  <a href="tutorial">Tutorial</a>
  <a href="language">Language</a>
  <a href="script-versioning">Script versioning</a>
  <a href="license">License</a>
  <a href="roadmap">Roadmap</a>
  <a href="help">Help</a>
  <a class="title" href="services">Services</a>
  <a class="sublink" href="service-http">HTTP service</a>
  <a class="title" href="api">API</a>
  <a href="commands">Commands</a>
  <a class="sublink" href="deploy-script">Deploy script</a>
  <a class="sublink" href="start-script">Start script</a>
  <a href="queries">Queries</a>
  <a class="sublink" href="query-script-execution">Script execution</a>
  <a class="title" href="service-spi">Service SPI</a>
  <a class="sublink" href="end-function">End function</a></div>
</div>

<div class="content">
  <h1>End function</h1>
  <p>Ends a waiting function invocation in a script execution.</p>

<h3 id="example">Example</h3>
<p>Here’s a <code class="highlighter-rouge">endFunction</code> example</p>

<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&gt; POST /command
  Content-Type: application/json
  { "endFunction" :
    { "scriptExecutionId" : "se1",
      "executionId" : "e46"
    }
  }
&lt; HTTP/1.1 200 OK
  Access-Control-Allow-Origin: *
  { "id":"sv1",
    "scriptId":"s1",
    "scriptName":"Test script",
    "version":1,
    "text":"var a\u003d0;",
    "active":true
  }
</code></pre></div></div>

<h3 id="request-properties">Request properties</h3>

<table>
  <thead>
    <tr>
      <th>Property name</th>
      <th>Required?</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="highlighter-rouge">scriptExecutionId</code></td>
      <td>Required</td>
      <td>String</td>
      <td>ID that identifies the script execution</td>
    </tr>
    <tr>
      <td><code class="highlighter-rouge">executionId</code></td>
      <td>Required</td>
      <td>String</td>
      <td>ID that identifies the function invocation which is a position within the script execution</td>
    </tr>
    <tr>
      <td><code class="highlighter-rouge">result</code></td>
      <td>Optional</td>
      <td>Any JSON value</td>
      <td>The return value coming out of the function invocation</td>
    </tr>
  </tbody>
</table>

<h3 id="response-properties">Response properties</h3>

<table>
  <thead>
    <tr>
      <th>Property name</th>
      <th>Data type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="highlighter-rouge">scriptExecutionId</code></td>
      <td>String</td>
      <td>ID of the script execution</td>
    </tr>
  </tbody>
</table>

</div>

</body>
</html>
